'use strict';
const db = uniCloud.database()
const dbcmd = db.command
exports.main = async (event, context) => {
	//event为客户端上传的参数
	const {article_id} = event
	// 浏览数加一
	await db.collection('article').doc(article_id).update({
		browse_count:dbcmd.inc(1)
	})
	const detail = await db.collection('article').aggregate()
	.match({
		_id:article_id
	})
	.project({
		comments:0
	})
	.end()
	
	//返回数据给客户端
	return {
		code:200,
		msg:'文章获取成功',
		data:detail	
	}
};
